package com.zw.a.basic.a12.demo07_reader_and_writer;

import java.io.*;

//案例: 演示字符高效流入门.
/*
    字符高效流简介:
        概述:
            指的是BufferedReader和BufferedWriter, 叫高效字符流, 字符缓冲流, 缓冲字符流.
        构造方法:
            public BufferedReader(Reader r);   缓冲流就是用来提供缓冲区的, 具体的读写还是普通流来做.
            public BufferedWriter(Writer w);
 */
public class Demo04 {
    public static void main(String[] args) throws IOException {
        //1. 通过字符缓冲输出流往文件中写一句话.
        /*BufferedWriter bw = new BufferedWriter(new FileWriter("day12/data/3.txt"));
        bw.write("好好学习, 天天向上!");
        bw.close();*/

        //2. 通过字符缓冲输入流读取文件中的内容
        /*BufferedReader br = new BufferedReader(new FileReader("day12/data/3.txt"));
        int len = 0;
        while((len = br.read()) != -1) {
            System.out.println((char)len);
        }
        br.close();*/
    }
}
